<template>
  <div>
    <div class="phone_box">
      <div class="logo_box">
        <div class="title">
          <span class="title_bg"> 中国建筑装饰协会 </span>
          <span class="title_sm"> 会员信息 </span>
        </div>
      </div>
    </div>
    <div class="user_head_box">
      <div class="head_img">
        <img :src="details.photoUrl" alt="" />
      </div>
      <div class="info_box_msg">
        <div class="title">
          {{ details.userName }}
        </div>
        <div class="title_number">证书编号 {{ details.certNum }}</div>
        <div class="time">
          {{ details.certTime }}
        </div>
      </div>
    </div>
    <div class="info_list">
      <span class="title">身份证号码: {{ details.idCard }}</span>
      <el-divider></el-divider>
      <span class="title">性别: {{ details.sex }}</span>
      <el-divider></el-divider>
      <span class="title">专业: {{ details.job }}</span>
      <el-divider></el-divider>
      <span class="title">分会部分: {{ details.dept }}</span>
      <el-divider></el-divider>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, onMounted, reactive, toRefs } from "vue";
import UserImg from "@/components/UserImg.vue";
import { getCertByID } from "@/utils/apis";
import { BASE_URL } from "@/utils/config";
import { useRoute } from "vue-router";
export default defineComponent({
  components: {
    UserImg,
  },
  name: "Home",
  setup() {
    const route = useRoute();
    const state = reactive({
      details: {},
      userInfo: {} as any,
    });
    onMounted(async () => {
      const { id } = route.query;
      const details = (await getCertByID({ id })).data;
      if (details.handImg) {
        details.photoUrl = `${BASE_URL}/userCert/photo?url=${details.handImg}`;
      }
      if (details.certTime) {
        details.certTime = details.certTime.split(" ")[0];
      }
      state.details = details;
      console.log(state.details);
    });
    return { ...toRefs(state) };
  },
});
</script>
<style  lang="scss" scope>
.info_list {
  .title {
    padding-left: 30px;
  }
}
.user_head_box {
  padding: 30px;
  box-sizing: border-box;
  background-color: #2d87c3;
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
  .info_box_msg {
    .title {
      font-weight: 600;
      font-size: 20px;
      color: #fff;
    }
    .title_number {
      font-size: 16px;
      margin-top: 14px;
      margin-bottom: 30px;
      color: #fff;
    }
    .time {
      width: 120px;
      height: 30px;
      line-height: 30px;
      text-align: center;
      border: 1px solid #44a9ed;
      color: #333;
      border-radius: 6px;
    }
  }
  .head_img {
    border: 3px solid #0e5e93;
    border-radius: 6px;
    height: 140px;
    width: 100px;
    img {
      width: 100%;
      height: 100%;
    }
  }
}
.phone_box {
  background: linear-gradient(
    to bottom,
    rgba(117, 189, 209, 1) 0%,
    rgba(39, 124, 184, 1) 95%,
    rgba(39, 124, 184, 1) 100%
  );
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#75bdd1', endColorstr='#277cb8', GradientType=0 );
  height: 80px;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;

  .logo_box {
    display: flex;
    justify-content: center;
    margin: 0;
    .title {
      color: #fff;
      .title_bg {
        font-size: 26px;
        font-weight: 600;
      }
      .title_sm {
        font-size: 18px;
      }
    }
  }
}
</style>
